<?php

namespace app\index\controller;

use app\admin\model\Advantage;
use app\admin\model\Engineering as EngineeringModel;
use app\admin\model\FriendUrls;
use app\admin\model\ProductCate;
use app\admin\model\About;
use app\admin\model\Product;
use app\admin\model\News;

class Index extends Base
{

    public function index()
    {
        $about  = About::find(5);
        $productCate = ProductCate::where(['status'=>1])->limit(0,5)->order('sort asc')->select();
        $product = Product::where(['status'=>1])->order('sort asc')->limit(0,8)->select();
        $engineering = EngineeringModel::where(['status'=>1])->order('sort asc')->limit(0,3)->select();
        $adv = Advantage::where('status',1)->select();
        $n = News::where(['status'=>1])->find();
        $news = News::where(['status'=>1])->order('sort asc')->limit(0,6)->select();
        $link = FriendUrls::select();
        return $this->view->fetch('',[
            'about' => $about,
            'productCate' => $productCate,
            'product' => $product,
            'engineering' => $engineering,
            'adv' => $adv,
            'n' => $n,
            'news' => $news,
            'link' => $link,
        ]);
    }

}
